package zuoye2;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test2 {
    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<>();
        map.put(1,"张三");
        map.put(2,"李四");
        map.put(10,"王五");

        System.out.println(map.size());//集合大小

        for (Integer key : map.keySet()) {
            String s = map.get(key);
            System.out.println("key="+key+",values"+s);
        }

        Set<Map.Entry<Integer, String>> entries = map.entrySet();
        for (Map.Entry<Integer, String> entry : entries) {
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"------------->"+value);

        }

        System.out.println(map.get(1));
        System.out.println(map.get(10));

        System.out.println(map.containsKey(10));

        System.out.println(map.remove(1));


    }
}
